package com.ruoyi.factorydata.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import java.util.List;

import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.factorydata.mapper.PurchaseOrderDetailMapper;
import com.ruoyi.factorydata.domain.PurchaseOrderDetail;
import com.ruoyi.factorydata.service.IPurchaseOrderDetailService;

/**
 * 采购单详情Service业务层处理
 *
 * @author ruoyi
 * @date 2025-07-17
 */
@Service
public class PurchaseOrderDetailServiceImpl extends ServiceImpl<PurchaseOrderDetailMapper, PurchaseOrderDetail> implements IPurchaseOrderDetailService {
    @Autowired
    private PurchaseOrderDetailMapper purchaseOrderDetailMapper;

    /**
     * 查询采购单详情
     *
     * @param id 采购单详情主键
     * @return 采购单详情
     */
    @Override
    public PurchaseOrderDetail selectPurchaseOrderDetailById(Long id) {
        return purchaseOrderDetailMapper.selectPurchaseOrderDetailById(id);
    }

    /**
     * 查询采购单详情列表
     *
     * @param purchaseOrderDetail 采购单详情
     * @return 采购单详情
     */
    @Override
    public List<PurchaseOrderDetail> selectPurchaseOrderDetailList(PurchaseOrderDetail purchaseOrderDetail) {
        return purchaseOrderDetailMapper.selectPurchaseOrderDetailList(purchaseOrderDetail);
    }

    /**
     * 新增采购单详情
     *
     * @param purchaseOrderDetail 采购单详情
     * @return 结果
     */
    @Override
    public int insertPurchaseOrderDetail(PurchaseOrderDetail purchaseOrderDetail) {
                purchaseOrderDetail.setCreateTime(DateUtils.getNowDate());
            return purchaseOrderDetailMapper.insertPurchaseOrderDetail(purchaseOrderDetail);
    }

    /**
     * 修改采购单详情
     *
     * @param purchaseOrderDetail 采购单详情
     * @return 结果
     */
    @Override
    public int updatePurchaseOrderDetail(PurchaseOrderDetail purchaseOrderDetail) {
                purchaseOrderDetail.setUpdateTime(DateUtils.getNowDate());
        return purchaseOrderDetailMapper.updatePurchaseOrderDetail(purchaseOrderDetail);
    }

    /**
     * 批量删除采购单详情
     *
     * @param ids 需要删除的采购单详情主键
     * @return 结果
     */
    @Override
    public int deletePurchaseOrderDetailByIds(Long[] ids) {
        return purchaseOrderDetailMapper.deletePurchaseOrderDetailByIds(ids);
    }

    /**
     * 删除采购单详情信息
     *
     * @param id 采购单详情主键
     * @return 结果
     */
    @Override
    public int deletePurchaseOrderDetailById(Long id) {
        return purchaseOrderDetailMapper.deletePurchaseOrderDetailById(id);
    }
}